import { defHttp } from '@/utils/http/axios'
import { AddorUpdateRoleModel } from './model/roleModel'

enum Api {
  RoleAddOrUpdate = '/role/addOrUpdate',
  GetAllResourceTree = '/role/getAllResourceTree',
  GetRoleDetail = '/role/detail',
  DeleteRole = '/role/delete'
}

export const addOrUpdateRole = (data: AddorUpdateRoleModel) => defHttp.post({ url: Api.RoleAddOrUpdate, data })
export const getResourceTree = () => defHttp.get({ url: Api.GetAllResourceTree })
export const getRoleDetail = (roleId: string) => defHttp.get({ url: Api.GetRoleDetail, params: { roleId } })
export const deleteRole = (roleId: string) => defHttp.get({ url: Api.DeleteRole, params: { roleId } })
